import { request, type Response } from '../http';

export function getHotelsList(payload: {
  /**
   * 入住日期
   * @requires
   */
  startDate: string;
  /**
   * 退房日期
   * @requires
   */
  endDate: string;
  /**
   * 房间数量
   * @requires
   */
  roomNumber: string;
  /**
   * 入住人数量
   * @requires
   */
  bookerNumber: string;
  /**
   * 成人数量
   */
  adultNumber?: string;
  /**
   * 儿童数量
   */
  childNumber?: string;
  /**
   * 婴儿数量
   */
  infantNumber?: string;
  /**
   * 是否短租 1、否 2、是
   */
  isLease?: '1' | '2';
}) {
  return request.post('/api/home/searchPropertyOnline', payload);
}

export function getHotelDetails(id: string) {
  return request.post('/api/pmsProperty/view', { id });
}

export interface IRoomsListPayload {
  /**
   * 酒店ID
   * @requires
   */
  puid: string;

  /**
   * 入住日期
   * @requires
   */
  startDate: string;

  /**
   * 退房日期
   * @requires
   */
  endDate: string;

  /**
   * 房间数量
   * @requires
   */
  roomNumber: string;

  /**
   * 入住人数量
   * @requires
   */
  bookerNumber: string;
}

export function getHotelRoomsList(payload: IRoomsListPayload) {
  return request.post<Response>('/api/roomType/list', payload);
}

export function getHotelRoomDetails(uid: string, id: string) {
  return request.post('/api/roomType/view', { uid, id });
}
